<script setup>
//目标：computed的使用
//作用：跟vue2中的computed一模一样
/* vue2写法
data() {
  return {
    count: 0
  }
},
computed: {
  doubleCount() {
    return this.count*2
  }
} */
//vue3写法
import { ref, computed } from 'vue'
const count = ref(0)
const doubleCount = computed(() => {
  return count.value * 2
})
</script>

<template>
  <div>
    doubleCount: {{ doubleCount }}
  </div>
  <button @click="count++">count++</button>
</template>

<style lang="scss" scoped>

</style>
